{% extends "../../main.html" %}

{% block title %}{{_("Create Game Level")}}{% end %}

{% block header %}
<script src="/static/js/pages/admin/create/game_level.js"></script>
{% end %}

{% block content %}
{% from tornado.options import options %}
<div class="container">
    <h1>
        <i class="fa fa-level-up"></i>
        {{_("Create Game Level")}}
    </h1>
    <br />
    {% if errors is not None and len(errors) != 0 %}
        {% for error in errors %}
        <div class="alert alert-error">
            <a class="close" data-dismiss="alert" href="#">&times;</a>
            <h4 class="alert-heading">{{_("ERROR")}}</h4>
            {{ error }}
        </div>
        {% end %}
    {% end %}
    <div class="well">
        <form class="form-horizontal" action="/admin/create/game_level" method="post">
            {% raw xsrf_form_html() %}
            <div class="control-group">
                <label class="control-label" for="level_number">{{_("Level Number")}}</label>
                <div class="controls">
                    <input autofocus required id="level-number" name="level_number" type="number" min=1 pattern="[0-9]+" placeholder="{{_('Level Number')}}"
                            rel="popover"
                            data-original-title="{{_('Level Number')}}"
                            data-content="{{_('Number of new Level')}} [0-9]+ {{_('Must be unique')}}" />
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="game_level-name">{{_("Level Name")}}</label>
                <div class="controls">
                    <input id="game_level-name" name="name" placeholder="{{_('Optional')}} {{_('Level Name')}}" maxlength="32" type="text"
                        rel="popover"
                        data-original-title="{{_('Level Name')}}"
                        data-content="({{_('Optional')}}) {{_('defaults to')}} &#34;Level #&#34;" />
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="game_level-reward">{{_("Completion Reward")}}</label>
                <div class="controls">
                    <input id="game_level-reward" name="reward" pattern="[0-9]+" value=0 placeholder="{{_('Reward')}}" type="number" min=0  
                        rel="popover"
                        data-original-title="{{_('Completion Reward')}}"
                        data-content="{{_('Bonus reward for those that complete the level.')}}" />
                </div>
            </div>
            <div id="gametype" class="control-group">
                <label class="control-label" for="game_level-type">{{_("Unlock Level")}}</label>
                <div class="controls">
                    <select id="game_level-type" name="type"
                        rel="popover"
                        data-original-title="{{_('Unlock Level')}}"
                        data-content="{{_('How should the next level unlock?')}}">
                        <option value="none">{{_("No Lock")}}</option>
                        <option value="locked">{{ _("Locked") }}</option>
                        <option value="buyout" selected>{{_("Purchase Unlock")}}</option>
                        <option value="progress">{{_("Game Progress")}}</option>
                        <option value="points">{{ _("Game Points") }}</option>
                        <option value="hidden">{{ _("Managed") }}</option>
                    </select>
                </div>
            </div>
            <div id="buyoutcost" class="control-group">
                <label id="buyoutlabel" class="control-label" for="buyout">{{_("Unlock Cost")}}</label>
                <div class="controls">
                    <input id="buyout" name="buyout" type="number" pattern="[0-9]+" placeholder="" type="number" value=50 min=0
                            rel="popover"
                            data-original-title="{{_('Unlock Cost')}}"
                            data-content="{{_('Cost to open this level and see flags')}} [0-9]+" />
                </div>
            </div>
            <div class="control-group">
                    <label class="control-label" for="description">{{ _("Description") }}</label>
                    <div class="controls">
                        <textarea id="description" name="description" placeholder="{{_('Optional')}} {{ _('Description') }}" maxlength="512" type="text"></textarea>
                    </div>
                </div>
            <div class="control-group">
                <div class="controls">
                    <button class="btn btn-primary" type="submit">{{_("Create Game Level")}}</button>
                </div>
            </div>
        </form>
    </div>
</div>
{% end %}
